from 点赞 import dianZan
from 登录 import getCookie, cookieLogin, AutoGetCookie
from user import getUsers
from 视频号 import getBVs

# 获取所有用户
users = getUsers.getUsers()

# # 手动点击验证登录存储所有用户cookie
# for user in users:
#     username=user.split('-')[0]
#     passwd=user.split('-')[1]
#     getCookie.getCookie(username,passwd)

# # 调用快识别API自动验证登录存储所有用户cookie
# for user in users:
#     username=user.split('-')[0]
#     passwd=user.split('-')[1]
#     AutoGetCookie.AutoGetCookie(username,passwd)

while True:
    # 获取所有需点赞的视频
    BVs = getBVs.getBVs()
    print('点赞队列：{},共{}个视频需点赞'.format(BVs, len(BVs)))
    # 登录所有用户账号，并点赞视频
    while len(BVs) > 0:
        print('当前点赞视频：{}'.format(BVs[0]))
        for user in users:
            username = user.split('-')[0]
            # cookie登录
            wd = cookieLogin.cookieLogin(username)
            dianZan.dianZan(BVs[0], wd)
            print('{} 点赞完成'.format(username))
        # 删除列表第一个元素
        del BVs[0]
